﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace _20170124_Practice_continued_Classes
{
    class TextInput
    {
        private string userInput;
        //private string folderPath = @"E:\Intetics_programming\IOtraining";
        private string textFile = @"E:\Intetics_programming\IOtraining\text_trane.txt";

        private void ReadFromUser()
        {
            Console.WriteLine("Please enter some text. . .");
            userInput = Console.ReadLine();
        }

        public void WriteToFile()
        {
            ReadFromUser();
            //File.Create(textFile);
            File.WriteAllText(textFile, userInput);
        }

        public void WordCalculator()
        {
            char[] delimiter = { ' ', ',', '.', ';', ':', '-', '\n', '\r', '\t', '(', ')' };
            string textRead = File.ReadAllText(textFile);
            string[] textArr = textRead.Split(delimiter);
            Console.WriteLine("{0} words", textArr.Count());
        }
    }
}
